Creating Custom Placeholders

Overview

Users can develop custom placeholders to retrieve data that is not represented by an existing placeholder, or to convert an existing placeholder to a different format, such as a different date format. You upload these custom placeholders to Workflow Integrator (WFI). When resolving placeholder values, WFI will look for custom placeholders first, then for predefined placeholders, and then try to resolve the values from fields in the ticket in SecureChange.

Create Custom Placeholders

You create a Python module called custom_functions.py, which contains all custom placeholder functions, and place it in a location where WFI can read it. Each custom placeholder function defined in the Python file uses a ticket object as a parameter and returns a string value. WFI uses the function name as the name for the custom placeholder.

Follow these steps to create custom placeholders in WFI:

  1. Create a Python file called custom_functions.py.

  2. Add function definitions for each custom placeholder.

    The definition is in the following format:

    def <name_of_function>(ticket, **kwargs):
    	return "text"
    The **kwargs parameter is required, but you do not replace it with anything.

    For details about the structure and contents of the ticket object, see Custom Placeholder Objects.

  3. Upload the custom_functions.py file so that WFI can find it:

    1. Run this command to retrieve the WFI pod name.

      # kubectl get pod -l app=workflowintegrator

      This command returns the following values:

      Value

      Example

      NAME workflowintegrator-649bb5979-znm6z
      READY 1/1
      STATUS Running
      RESTARTS 3
      AGE 10d
    2. Use the NAME value for <WFI_POD_NAME> in this command.

      # kubectl cp custom_functions.py <WFI_POD_NAME>:/app/plugins/